﻿/*----------------------------------------------------------------
    // Copyright (C) 2009 江苏华招网
    // 版权所有。 
    // 作者：吕海乐 
    //
    // 文件名：DistributePlanMod.cs
    // 文件功能描述：配送计划管理：修改配送计划
    // 创建标识：吕海乐2009-03-19
    //
    // 修改标识：
    // 修改描述：
    //
    // 修改标识：
    // 修改描述：
    //
    // 审核人：页面作废 2009-6-4 李刚
// 审核时间：
// 审核说明：
 //----------------------------------------------------------------*/
using System;
using System.Collections;
using System.Configuration;
using System.Data;

using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;

using HZ.DrugTrade.Web;
using HZ.DrugTrade.Model;
using HZ.DrugTrade.Model.Enum;
using HZ.DrugTrade.IBLL;
using HZ.DrugTrade.BLLFactory;

namespace HZ.DrugTrade.Web.Admin
{
    public partial class DistributePlanMod : BasePage
    {
        public DistributePlanMod()
        {
            this.ModuleNo = Module.采购项目管理.ToString();
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            //绑定要修改的信息
            if (!this.IsPostBack)
            {
                string projectId = Request.QueryString["id"];
                IBLL_ProcurementBasic ipb = Factory.BLL_ProcurementBasic();
                ProcurementProject project = ipb.GetProcurementProjectByID(projectId);
                txtDistributePlanId.Text = project.ProjectID;
                txtDistributePlanName.Text = project.ProjectName.ToString();
                txtDistributePlanStartTime.Text = project.ProcureStartTime.ToString();
                txtDistributePlanEndTime.Text = project.ProcureEndTime.ToString();
            }
        }

        /// <summary>
        /// 修改配送计划
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void btnDistributePlanMod_Click(object sender, EventArgs e)
        {
            if (Page.IsValid)
            {
                //获取项目的相关信息
                ProcurementProject project = new ProcurementProject();
                project.ProjectID = txtDistributePlanId.Text.Trim();
                project.ProjectName = txtDistributePlanName.Text;
                project.ProcureStartTime = Convert.ToDateTime(txtDistributePlanStartTime.Text);
                project.ProcureEndTime = Convert.ToDateTime(txtDistributePlanEndTime.Text);

                //修改项目，判断操作情况
                IBLL_ProcurementBasic ipb = Factory.BLL_ProcurementBasic();
                int flag = ipb.UpdateProcurementProject(project);
                switch (flag)
                {
                    case 0:
                        PageError("修改失败！", "DistributePlanList.aspx");
                        break;
                    case 1:
                        PageInfo("修改成功！", "DistributePlanList.aspx");
                        break;
                    default:
                        break;
                }
            }
        }
    }
}
